<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set value="${pageContext.request.contextPath}" scope="page" var="ctx"></c:set>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String currRequestURL="";

	try{
		currRequestURL = request.getRequestURL().toString();
	}catch(Exception e){
	}
	System.out.println("currRequestURL:"+currRequestURL);
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>一键拉取/同步工人信息到本机</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>一键拉取/同步工人数据到本机</legend>
        </fieldset>

        <form class="layui-form" action="">
            
              <div class="layui-form-item">
                <label class="layui-form-label">项目编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="ProjectSysNo"  lay-verify="project_code" placeholder="项目编号" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">非必填，不填则拉取所有项目</div>
            </div>
            
              <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" name="forsubmit" lay-filter="forsubmit">立即提交至DAO后台</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

        <!-- 示例-970 -->
        <ins class="adsbygoogle" style="display:inline-block;width:970px;height:90px" data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>


    </div>
</div>

<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../../js/jquery-3.2.1.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate','layer'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');

        //自定义验证规则
        form.verify({
	
            
        /* 	project_code:[
        		/^[1-9]\d{5}$/
                    ,'云筑网目前的项目号都是6位数字的，请按实际进行填写'
            ]    */
        	  
        	
        });

var fromdata1;
        //监听提交
        form.on('submit(forsubmit)', function (data) {
        	
        	
  	fromdata1 = JSON.stringify(data.field);
  	layer.confirm(JSON.stringify(data.field), {icon: 3, title:'最終提交的信息如下，确定提交吗？'}, function(index){
  		$('button[name="forsubmit"]').addClass("layui-btn-disabled").attr("disabled",true);    
        //do something
           myajax =  $.ajax({
     type: "POST",
     url: "../../page/SynchronousWorkerListNewBaseInfoNewBaseInfo",
     /* dataType:"json", */
     contentType : "application/json;charset=UTF-8",
     data: fromdata1,
     success: function (res) {
    	 /* var jsonRes = typeof res == 'string'?JSON.parse(res):res; */ 
          if (res != null || res.body != null) {
         	 /* var a = JSON.parse(res); */
         	 
         	 /* layer.msg('res:'+JSON.stringify(jsonRes)); */
         	  layer.msg(res); 
         	
           	$('button[name="forsubmit"]').removeClass("layui-btn-disabled").attr("disabled",false);
         } else {
        	 console.log(res);
         	 layer.msg('res:'+res);
             layer.alert("未查到该项目号！");
         } 
    	 
    	 
     }
             
 });
           layer.close(index);
           layer.msg('已提交！请稍等...');
           
           /* $.when(myajax).done(function () {
           	
             }); */
        
        
      });
  	
            
            return false;
        });

      

    });
</script>

</body>
</html>